/*
 * World.cpp
 * Models the world (comprising the environment the sprites which
 * make up the world inhabit). Also exists as the main conduit of
 * information from the controllers to the model. Can be loaded
 * from a file as a "level".
 */

#include "World.h"

// Construct a world with a specified background.
World::World(const std::string& imagePath) {
	hero = new Hero();
	block = new Sprite(CL_Color::coral, 200, 200, 64, 64);
	surface_background = new CL_Surface(imagePath);
}

// Draw this onto the CL_Display.
void World::paint() {
	// First we want to clear the screen to a certain R, G, B, A color
	CL_Display::clear(CL_Color(0, 0, 0, 255));

	// Now draw the background
	surface_background->draw(0, 0);

	// Now draw the foreground
	block->paint();
	hero->paint();
}

// Destroy this world.
World::~World() {
	delete surface_background;
	delete block;
	delete hero;
}
